home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Views / Includes / UDialog.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  46.4 KB  |  1,396 lines  |  [TEXT/MPS ]

  1. // UDialog.h
  2. // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UDIALOG__
  5. #define __UDIALOG__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __UCOMMAND__
  10. #include "UCommand.h"
  11. #endif
  12.  
  13. #ifndef __UCONTROL__
  14. #include "UControl.h"
  15. #endif
  16.  
  17. #ifndef __UGEOMETRY__
  18. #include "UGeometry.h"
  19. #endif
  20.  
  21. #ifndef __UTEVIEW__
  22. #include "UTEView.h"
  23. #endif
  24.  
  25. // Toolbox
  26.  
  27. #ifndef __ICONS__
  28. #include <Icons.h>
  29. #endif
  30.  
  31. //----------------------------------------------------------------------------------------
  32. // Forward and external class declarations. 
  33. //----------------------------------------------------------------------------------------
  34.  
  35. class TAssociation;
  36. class TDocument;
  37. class TTEView;
  38. class TScroller;
  39. class TToolboxEvent;
  40. class TEditText;
  41. class TDialogTEView;
  42.  
  43.  
  44. //----------------------------------------------------------------------------------------
  45. // Some constants
  46. //----------------------------------------------------------------------------------------
  47.  
  48. const Boolean kPreferColor = TRUE;                // argument to IIcon
  49.  
  50. const Boolean kControlOn = TRUE;                // argument to ICheckBox and IRadio
  51.  
  52. const short kMaxTEWidth = 688;                    // Maximum width for TEditText autoscroll
  53.  
  54. const ResNumber phInvalidValue = 300;            // Alert used when an invalid value is
  55.                                                 // entered
  56.                                                 
  57. const ResNumber kDialogTEViewID = 300;            // The ID of the 'view' resource for the
  58.                                                 // "floating" TEView
  59.  
  60. const ResNumber kInvalidValueReasons = 300;        // CString list used for invalid value
  61.                                                 // alert
  62.                                                 
  63. const short kErrorHandled = -1;                    // Don't post an alert, the user handled
  64.                                                 // it
  65.                                                 
  66. const long kValidValue = 0;                        // Not looked up in the CString list.
  67.  
  68. const long kInvalidValue = 1;
  69.  
  70. const long kValueTooSmall = 2;
  71.  
  72. const long kValueTooLarge = 3;
  73.  
  74. const long kNonNumericCharacters = 4;
  75.  
  76. const long kTooManyCharacters = 5;
  77.  
  78. const long kNoOfDefaultReasons = 5;
  79.  
  80.  
  81. //----------------------------------------------------------------------------------------
  82. // TDialogView: Installs a TDialogBehavior in the window 
  83. //----------------------------------------------------------------------------------------
  84.  
  85. class TDialogView : public TView
  86. {
  87.     MA_DECLARE_CLASS;
  88.     
  89. public:
  90.     TDialogView();
  91.         // Constructor
  92.     virtual ~TDialogView();
  93.         // Destructor
  94.         
  95.     void IDialogView(TDocument* itsDocument,
  96.                                     TView* itsSuperView,
  97.                                     const VPoint& itsLocation,
  98.                                     const VPoint& itsSize,
  99.                                     SizeDeterminer itsHSizeDet,
  100.                                     SizeDeterminer itsVSizeDet,
  101.                                     IDType itsDefItemID,
  102.                                     IDType itsCancelItemID);
  103.         // Initialization method for TDialogView.
  104.  
  105.     virtual void DoPostCreate(TDocument* itsDocument);    // Override
  106.         // Overridden to install a TDialogBehavior in the window , if necessary,
  107.         // and set its attributes (default item and cancel item)
  108.         
  109.     //------------------------------------------------------------------------------------
  110.     // Standard signature support.
  111.     //------------------------------------------------------------------------------------
  112.  
  113.     virtual IDType GetStandardSignature();    // Override 
  114.         // Returns this class's standard signature.
  115.  
  116.     //------------------------------------------------------------------------------------
  117.     // Stream I/O protocol support.
  118.     //------------------------------------------------------------------------------------
  119.  
  120.     virtual void ReadFields(TStream* aStream);
  121.     
  122.     virtual void WriteFields(TStream* aStream);
  123.  
  124.     //------------------------------------------------------------------------------------
  125.     // data members
  126.     //------------------------------------------------------------------------------------
  127. public:
  128.     IDType fDefaultItem;                        // The identifier of the default item
  129.  
  130.     IDType fCancelItem;                            // The identifier of item that cancels
  131.                                                 // dialog
  132. };
  133.  
  134.  
  135. //----------------------------------------------------------------------------------------
  136. // TButton: Mimics a typical toolbox button as used in a dialog.
  137. //----------------------------------------------------------------------------------------
  138.  
  139. class TButton : public TCtlMgr
  140. {
  141.     MA_DECLARE_CLASS;
  142.     
  143. public:
  144.     TButton();
  145.         // Constructor
  146.     virtual ~TButton();
  147.         // Destructor
  148.         
  149.     void IButton(TView* itsSuperView,
  150.                                 const VPoint& itsLocation,
  151.                                 const VPoint& itsSize,
  152.                                 SizeDeterminer itsHSizeDet,
  153.                                 SizeDeterminer itsVSizeDet,
  154.                                 const CStr255& itsLabel);
  155.         // Initializes the button setting the fDefaultChoice field to mButtonHit.
  156.  
  157.     //------------------------------------------------------------------------------------
  158.     // Standard signature support.
  159.     //------------------------------------------------------------------------------------
  160.  
  161.     virtual IDType GetStandardSignature();    // Override 
  162.         // Returns this class's standard signature.
  163.  
  164.     //------------------------------------------------------------------------------------
  165.     // Stream I/O protocol support.
  166.     //------------------------------------------------------------------------------------
  167.  
  168.     virtual void ReadFields(TStream* aStream);
  169.     
  170.     virtual void WriteFields(TStream* aStream);
  171.  
  172.  
  173.     virtual void DoEvent(EventNumber eventNumber,
  174.                                 TEventHandler* source,
  175.                                 TEvent* event);
  176.         // If the hit is mButtonHit then flash the button provided you didn't hit
  177.         // yourself.
  178.  
  179.     //------------------------------------------------------------------------------------
  180.     // data members
  181.     //------------------------------------------------------------------------------------
  182. public:
  183.     ResNumber    fStrListID;                        // button's label:    STR# rsrc id
  184.  
  185.     short        fIndex;                            //                    index into STR#
  186.  
  187. };
  188.  
  189.  
  190. //----------------------------------------------------------------------------------------
  191. // TCheckBox: Provides the functionality of a toolbox checkbox.
  192. //----------------------------------------------------------------------------------------
  193.  
  194. class TCheckBox : public TCtlMgr
  195. {
  196.     MA_DECLARE_CLASS;
  197.     
  198. public:
  199.     TCheckBox();
  200.         // Constructor
  201.     virtual ~TCheckBox();
  202.         // Destructor
  203.         
  204.     void ICheckBox(TView* itsSuperView,
  205.                                   const VPoint& itsLocation,
  206.                                   const VPoint& itsSize,
  207.                                   SizeDeterminer itsHSizeDet,
  208.                                   SizeDeterminer itsVSizeDet,
  209.                                   const CStr255& itsLabel,
  210.                                   Boolean isTurnedOn);
  211.         // Initialize the checkbox setting fDefaultChoice to mCheckBoxHit.
  212.  
  213.     //------------------------------------------------------------------------------------
  214.     // Standard signature support.
  215.     //------------------------------------------------------------------------------------
  216.  
  217.     virtual IDType GetStandardSignature();    // Override 
  218.         // Returns this class's standard signature.
  219.  
  220.     //------------------------------------------------------------------------------------
  221.     // Stream I/O protocol support.
  222.     //------------------------------------------------------------------------------------
  223.  
  224.     virtual void ReadFields(TStream* aStream);
  225.     
  226.     virtual void WriteFields(TStream* aStream);
  227.  
  228.  
  229.     virtual void DoEvent(EventNumber eventNumber,
  230.                                 TEventHandler* source,
  231.                                 TEvent* event);
  232.         // If the hit is mCheckBoxHit then toggle the checkbox.
  233.  
  234.     virtual Boolean IsOn();
  235.         // Is the checkbox currently checked.
  236.  
  237.     virtual void SetState(Boolean state, Boolean redraw);
  238.         // Sets the state of the checkbox to state and if redraw is true redraws it.
  239.  
  240.     virtual void Toggle(Boolean redraw);
  241.         // Toggles the state of the checkbox redraw it if redraw is true.
  242.  
  243.     virtual void ToggleIf(Boolean matchState, Boolean redraw);
  244.         // Toggles the state of the checkbox if matchState is true redrawing if redraw is
  245.         // true.
  246.  
  247.     //------------------------------------------------------------------------------------
  248.     // data members
  249.     //------------------------------------------------------------------------------------
  250. public:
  251.     ResNumber    fStrListID;                        // check box's label:    STR# rsrc id
  252.  
  253.     short        fIndex;                            //                    index into STR#
  254.  
  255. };
  256.  
  257.  
  258. //----------------------------------------------------------------------------------------
  259. // TRadio: Provides the functionality of a toolbox radio button.
  260. //----------------------------------------------------------------------------------------
  261.  
  262. class TRadio : public TCtlMgr
  263. {
  264.     MA_DECLARE_CLASS;
  265.     
  266. public:
  267.     TRadio();
  268.         // Constructor
  269.     virtual ~TRadio();
  270.         // Destructor
  271.         
  272.     void IRadio(TView* itsSuperView,
  273.                                const VPoint& itsLocation,
  274.                                const VPoint& itsSize,
  275.                                SizeDeterminer itsHSizeDet,
  276.                                SizeDeterminer itsVSizeDet,
  277.                                const CStr255& itsLabel,
  278.                                Boolean isTurnedOn);
  279.         // Initalize the radio button procedurally.
  280.  
  281.     //------------------------------------------------------------------------------------
  282.     // Standard signature support.
  283.     //------------------------------------------------------------------------------------
  284.  
  285.     virtual IDType GetStandardSignature();    // Override 
  286.         // Returns this class's standard signature.
  287.  
  288.     //------------------------------------------------------------------------------------
  289.     // Stream I/O protocol support.
  290.     //------------------------------------------------------------------------------------
  291.  
  292.     virtual void ReadFields(TStream* aStream);
  293.     
  294.     virtual void WriteFields(TStream* aStream);
  295.  
  296.     virtual void DoPostCreate(TDocument* itsDocument); // Override
  297.         // Calls HandleEvent(mRadioHit…) if the radio is on so a cluster can synch up
  298.     
  299.     virtual void DoEvent(EventNumber eventNumber,
  300.                                 TEventHandler* source,
  301.                                 TEvent* event);
  302.         // If the hit is mRadioHit then toggle the radio button.
  303.  
  304.     virtual Boolean IsOn();
  305.         // Is the radio button currently on.
  306.  
  307.     virtual void SetState(Boolean state, Boolean redraw);
  308.         // Sets the state of the radio button to state, redrawing if redraw is true.
  309.  
  310.     virtual void Toggle(Boolean redraw);
  311.         // Toggles the state of the radio button, redrawing if redraw is true.
  312.  
  313.     virtual void ToggleIf(Boolean matchState, Boolean redraw);
  314.         // Only toggles the state of the radio button if matchState is true, redrawing if
  315.         // redraw is true.
  316.  
  317.     //------------------------------------------------------------------------------------
  318.     // data members
  319.     //------------------------------------------------------------------------------------
  320. public:
  321.     ResNumber    fStrListID;                        // radio's label:    STR# rsrc id
  322.  
  323.     short        fIndex;                            //                    index into STR#
  324.  
  325. };
  326.  
  327.  
  328. //----------------------------------------------------------------------------------------
  329. // TCluster: Provides a mechanism whereby radio buttons can be grouped in clusters, such
  330. // that when one of the buttons is selected the others are all deselected. Also can be
  331. // utilized for providing labelled adornments around groups of dialog items.
  332. //----------------------------------------------------------------------------------------
  333.  
  334. class TCluster : public TControl
  335. {
  336.     MA_DECLARE_CLASS;
  337.     
  338. public:
  339.     TCluster();
  340.         // Constructor
  341.         
  342.     void ICluster(TView* itsSuperView,
  343.                                  const VPoint& itsLocation,
  344.                                  const VPoint& itsSize,
  345.                                  SizeDeterminer itsHSizeDet,
  346.                                  SizeDeterminer itsVSizeDet,
  347.                                  ResNumber itsRsrcID,
  348.                                  short itsIndex);
  349.         // Initialize the cluster procedurally.
  350.  
  351.     virtual TObject* Clone();
  352.         // Calls Inherited::Clone and then clones owned objects.
  353.         
  354.     virtual ~TCluster();
  355.         // Release the label and call Inherited::Free.
  356.  
  357.     //------------------------------------------------------------------------------------
  358.     // Standard signature support.
  359.     //------------------------------------------------------------------------------------
  360.  
  361.     virtual IDType GetStandardSignature();    // Override 
  362.         // Returns this class's standard signature.
  363.  
  364.     //------------------------------------------------------------------------------------
  365.     // Stream I/O protocol support.
  366.     //------------------------------------------------------------------------------------
  367.  
  368.     virtual void ReadFields(TStream* aStream);
  369.     
  370.     virtual void WriteFields(TStream* aStream);
  371.  
  372.  
  373.     virtual void Draw(const VRect& area);
  374.         // Frame the cluster if there is a label, then draw the label.
  375.  
  376.     virtual void DrawLabel(const VRect& area);
  377.         // Draw the label.
  378.  
  379.     virtual void DoEvent(EventNumber eventNumber,
  380.                                 TEventHandler* source,
  381.                                 TEvent* event);
  382.         // Responsible for resetting the radio buttons so that the last selected one is
  383.         // the only one selected.
  384.  
  385.     virtual void GetLabel(CStr255& theLabel);
  386.         // Returns in theLable the text in the clusters label.
  387.  
  388.     virtual void ReleaseLabel();
  389.         // Releases fDataHandle which is a CString handle containing the text for the
  390.         // label.
  391.  
  392.     virtual void SetLabel(const CStr255& theLabel, Boolean redraw);
  393.         // Sets the clusters label to be theLabel, redrawing if redraw is true.
  394.  
  395.     virtual void SetLabelWithStrListID(ResNumber theStrListID, short theIndex, Boolean redraw);
  396.         // Set fDataHandle to the string specified by theStrListID and theIndex and sets fStrListID
  397.         // and fIndex accordingly.
  398.  
  399.     virtual IDType GetCurrentChoice();
  400.         // Returns the ID of the currently selected button
  401.  
  402.     virtual void SetCurrentChoice(IDType newChoice);
  403.         // Highlights the specified button, and turns off all others off
  404.  
  405.     //------------------------------------------------------------------------------------
  406.     // data members
  407.     //------------------------------------------------------------------------------------
  408. public:
  409.     CStringHandle fDataHandle;                    // the cluster's label
  410.     IDType fCurrentChoice;                        // the ID of the currently selected radio button
  411.  
  412.     ResNumber fStrListID;                        // STR# rsrc id of the cluster's label
  413.  
  414.     short fIndex;                                // index into STR#
  415. };
  416.  
  417.  
  418. //----------------------------------------------------------------------------------------
  419. // TIcon: Provides an icon that can behave as a button.
  420. //----------------------------------------------------------------------------------------
  421.  
  422. class TIcon : public TControl
  423. {
  424.     MA_DECLARE_CLASS;
  425.     
  426. public:
  427.     TIcon();
  428.         // Constructor
  429.         
  430.     virtual ~TIcon();
  431.         // Destructor.
  432.  
  433.     virtual void Free();
  434.         // Release the icon then call Inherited::Free.
  435.  
  436.     void IIcon(TView* itsSuperView,
  437.                               const VPoint& itsLocation,
  438.                               const VPoint& itsSize,
  439.                               SizeDeterminer itsHSizeDet,
  440.                               SizeDeterminer itsVSizeDet,
  441.                               ResNumber itsRsrcID,
  442.                               Boolean preferColor);
  443.         // Initialize the view template.
  444.  
  445.     virtual TObject* Clone();
  446.         // Calls Inherited::Clone and then clones owned objects.
  447.  
  448.  
  449.     //------------------------------------------------------------------------------------
  450.     // Standard signature support.
  451.     //------------------------------------------------------------------------------------
  452.  
  453.     virtual IDType GetStandardSignature();    // Override 
  454.         // Returns this class's standard signature.
  455.  
  456.     //------------------------------------------------------------------------------------
  457.     // Stream I/O protocol support.
  458.     //------------------------------------------------------------------------------------
  459.  
  460.     virtual void ReadFields(TStream* aStream);
  461.     
  462.     virtual void WriteFields(TStream* aStream);
  463.  
  464.     //------------------------------------------------------------------------------------
  465.     // Data member accessors.
  466.     //------------------------------------------------------------------------------------
  467.  
  468.     virtual void ReleaseIcon();
  469.         // Releases the handle to the icon.
  470.  
  471.     virtual void SetIcon(Handle theIcon, Boolean redraw);
  472.         // Sets fDataHandle to theIcon, redrawing if redraw is true.
  473.  
  474.     virtual void SetIconRsrcID(ResNumber itsRsrcID, Boolean redraw);
  475.         // setter for fRsrcID
  476.  
  477.     //------------------------------------------------------------------------------------
  478.     // Imaging.
  479.     //------------------------------------------------------------------------------------
  480.  
  481.     virtual void Draw(const VRect& area);
  482.         // Resonsible for drawing the icon and any required adornments.
  483.  
  484.     //------------------------------------------------------------------------------------
  485.     // data members
  486.     //------------------------------------------------------------------------------------
  487. public:
  488.     Handle fDataHandle;
  489.  
  490.     ResNumber fRsrcID;
  491.  
  492.     Boolean fPreferColor;                        // tells us how to GET the icon - GetCIcon
  493.                                                 // or GetIcon
  494.  
  495.     Boolean fIsColor;                            // tells us how to DRAW or FREE the icon
  496. };
  497.  
  498.  
  499. //----------------------------------------------------------------------------------------
  500. // TIconSuite: Uses System 7 icon utilities to display icons from an icon suite
  501. //----------------------------------------------------------------------------------------
  502.  
  503. class TIconSuite : public TIcon
  504. {
  505.  
  506.     MA_DECLARE_CLASS;
  507.  
  508. public:
  509.     TIconSuite();
  510.         // Constructor
  511.  
  512.     virtual ~TIconSuite();
  513.  
  514.     virtual void IIconSuite(TView* itsSuperView,
  515.                                            const VPoint& itsLocation,
  516.                                            const VPoint& itsSize,
  517.                                            SizeDeterminer itsHSizeDet,
  518.                                            SizeDeterminer itsVSizeDet,
  519.                                            ResNumber itsRsrcID,
  520.                                            Boolean preferColor);
  521.  
  522.     virtual void ReadFields(TStream* aStream);
  523.  
  524.     virtual IDType GetStandardSignature();
  525.  
  526.     virtual void Draw(const VRect& area);
  527.     // Draw the view.
  528.  
  529.     virtual void GetExtentRegion(RgnHandle itsExtentRgn);
  530.     // Returns the Icon's mask as the region
  531.  
  532.     virtual CRect GetIconRect();
  533.     // return the rect to use when plotting the icon or getting its icon info
  534.  
  535.     virtual void Hilite();    
  536.  
  537.     virtual void HiliteState(Boolean state,
  538.                                     Boolean redraw);
  539.  
  540.     virtual void Dim();    
  541.  
  542.     virtual void DimState(Boolean state,
  543.                                     Boolean redraw);
  544.  
  545.     virtual void ReleaseIcon();
  546.  
  547.     virtual void SetIconRsrcID(ResNumber itsRsrcID,
  548.                                       Boolean redraw);
  549.  
  550. protected:
  551.     Boolean fHasSuite;                                // TRUE if an Icon Suite is loaded (instead of ICON/cicn)
  552.     IconAlignmentType fAlignmentType;                // How the icon should be aligned in the view
  553.     IconTransformType fNormalTransform;                // How the icon is transformed to display normally
  554.     IconTransformType fHiliteTransform;                // How the icon is transformed to display hilited
  555.     IconTransformType fDimTransform;                // How the icon is transformed to display dimmed
  556. };
  557.  
  558.  
  559. //----------------------------------------------------------------------------------------
  560. // TSmallIcon
  561. //----------------------------------------------------------------------------------------
  562.  
  563. class TSmallIcon : public TControl
  564. {
  565.     MA_DECLARE_CLASS;
  566.     
  567. public:
  568.     TSmallIcon();
  569.         // Constructor
  570.     virtual ~TSmallIcon();
  571.         // Destructor
  572.         
  573.     void ISmallIcon(TView* itsSuperView,
  574.                                    const VPoint& itsLocation,
  575.                                    const VPoint& itsSize,
  576.                                    SizeDeterminer itsHSizeDet,
  577.                                    SizeDeterminer itsVSizeDet,
  578.                                    ResNumber itsRsrcID);
  579.  
  580.     virtual TObject* Clone();
  581.         // Calls Inherited::Clone and then clones owned objects.
  582.  
  583.     //------------------------------------------------------------------------------------
  584.     // Standard signature support.
  585.     //------------------------------------------------------------------------------------
  586.  
  587.     virtual IDType GetStandardSignature();    // Override 
  588.         // Returns this class's standard signature.
  589.  
  590.     //------------------------------------------------------------------------------------
  591.     // Stream I/O protocol support.
  592.     //------------------------------------------------------------------------------------
  593.  
  594.     virtual void ReadFields(TStream* aStream);
  595.     
  596.     virtual void WriteFields(TStream* aStream);
  597.  
  598.     //------------------------------------------------------------------------------------
  599.     // Data member accessors.
  600.     //------------------------------------------------------------------------------------
  601.  
  602.     virtual void ReleaseSmallIcon();
  603.  
  604.     virtual void SetSmallIcon(ResNumber theSmallIcon, Boolean redraw);
  605.  
  606.     //------------------------------------------------------------------------------------
  607.     // Imaging.
  608.     //------------------------------------------------------------------------------------
  609.  
  610.     virtual void Draw(const VRect& area);
  611.  
  612.     //------------------------------------------------------------------------------------
  613.     // data members
  614.     //------------------------------------------------------------------------------------
  615. public:
  616.     Handle fDataHandle;
  617.  
  618.     ResNumber fRsrcID;
  619. };
  620.  
  621.  
  622. //----------------------------------------------------------------------------------------
  623. // TPattern: Provides an object that can display a pattern and can also behave as a button
  624. // if required.
  625. //----------------------------------------------------------------------------------------
  626.  
  627. class TPattern : public TControl
  628. {
  629.     MA_DECLARE_CLASS;
  630.     
  631. public:
  632.     TPattern();
  633.         // Constructor
  634.         
  635.     void IPattern(TView* itsSuperView,
  636.                                  const VPoint& itsLocation,
  637.                                  const VPoint& itsSize,
  638.                                  SizeDeterminer itsHSizeDet,
  639.                                  SizeDeterminer itsVSizeDet,
  640.                                  ResNumber itsRsrcID,
  641.                                  Boolean preferColor);
  642.         // Initialize the pattern procedurally.
  643.  
  644.     virtual TObject* Clone();
  645.         // Calls Inherited::Clone and then clones owned objects.
  646.  
  647.     virtual ~TPattern();
  648.         // Release the pattern then call Inherited::Free.
  649.  
  650.     //------------------------------------------------------------------------------------
  651.     // Standard signature support.
  652.     //------------------------------------------------------------------------------------
  653.  
  654.     virtual IDType GetStandardSignature();    // Override 
  655.         // Returns this class's standard signature.
  656.  
  657.     //------------------------------------------------------------------------------------
  658.     // Stream I/O protocol support.
  659.     //------------------------------------------------------------------------------------
  660.  
  661.     virtual void ReadFields(TStream* aStream);
  662.     
  663.     virtual void WriteFields(TStream* aStream);
  664.  
  665.     //------------------------------------------------------------------------------------
  666.     // Data member accessors.
  667.     //------------------------------------------------------------------------------------
  668.  
  669.     virtual void ReleasePattern();
  670.         // Releases the pattern by disposing fDataHandle.
  671.  
  672.     virtual void SetPattern(Handle thePattern, Boolean redraw);
  673.         // Sets fDataHandle to thePattern, redrawing if redraw is true.
  674.  
  675.     virtual void SetPatternRsrcID(ResNumber itsRsrcID, Boolean redraw);
  676.         // setter for fRsrcID
  677.  
  678.     //------------------------------------------------------------------------------------
  679.     // Imaging.
  680.     //------------------------------------------------------------------------------------
  681.  
  682.     virtual void Draw(const VRect& area);
  683.         // Responsible for drawing the pattern and any required adornments.
  684.  
  685.     //------------------------------------------------------------------------------------
  686.     // data members
  687.     //------------------------------------------------------------------------------------
  688. public:
  689.     Handle fDataHandle;
  690.  
  691.     ResNumber fRsrcID;
  692.  
  693.     Boolean fPreferColor;                        // tells us how to GET the pattern
  694.  
  695.     Boolean fIsColor;                            // tells us how to DRAW or FREE the
  696.                                                 // pattern
  697. };
  698.  
  699.  
  700. //----------------------------------------------------------------------------------------
  701. // TPicture: Provides an object that can display a PICT and if required behave like a
  702. // button.
  703. //----------------------------------------------------------------------------------------
  704.  
  705. class TPicture : public TControl
  706. {
  707.     MA_DECLARE_CLASS;
  708.     
  709. public:
  710.     TPicture();
  711.         // Constructor
  712.         
  713.     void IPicture(TView* itsSuperView,
  714.                                  const VPoint& itsLocation,
  715.                                  const VPoint& itsSize,
  716.                                  SizeDeterminer itsHSizeDet,
  717.                                  SizeDeterminer itsVSizeDet,
  718.                                  ResNumber itsRsrcID);
  719.         // Initialize the picture procedurally.
  720.  
  721.     virtual TObject* Clone();
  722.         // calls Inherited::Clone and then clones owned objects
  723.  
  724.     virtual ~TPicture();
  725.         // Release the picture then call Inherited::Free.
  726.  
  727.     //------------------------------------------------------------------------------------
  728.     // Standard signature support.
  729.     //------------------------------------------------------------------------------------
  730.  
  731.     virtual IDType GetStandardSignature();    // Override 
  732.         // Returns this class's standard signature.
  733.  
  734.     //------------------------------------------------------------------------------------
  735.     // Stream I/O protocol support.
  736.     //------------------------------------------------------------------------------------
  737.  
  738.     virtual void ReadFields(TStream* aStream);
  739.     
  740.     virtual void WriteFields(TStream* aStream);
  741.  
  742.     //------------------------------------------------------------------------------------
  743.     // Data member accessors.
  744.     //------------------------------------------------------------------------------------
  745.  
  746.     virtual void ReleasePicture();
  747.         // Releases the PICT by disposing of fDataHandle.
  748.  
  749.     virtual void SetPicture(PicHandle thePicture, Boolean redraw);
  750.         // Sets fDataHandle to thePicture, redrawing if redraw is true.
  751.  
  752.     virtual void SetPictureRsrcID(ResNumber itsRsrcID, Boolean redraw);
  753.         // setter for fRsrcID
  754.  
  755.     //------------------------------------------------------------------------------------
  756.     // Imaging.
  757.     //------------------------------------------------------------------------------------
  758.  
  759.     virtual void Draw(const VRect& area);
  760.         // Responsible for drawing the PICT and any required adornments.
  761.         
  762.     //------------------------------------------------------------------------------------
  763.     // Drag & Drop
  764.     //------------------------------------------------------------------------------------
  765. #if qDrag
  766.     
  767.     virtual Boolean WillDrag(const VPoint& theMouse, const RgnHandle dragCursorRegion);
  768.         // return true if picture content exists, and the view is draggable
  769.  
  770.     virtual void DoAddDragContent();
  771.         // Install PICT flavor data as a promise
  772.  
  773.     virtual Boolean WillAcceptDrop(CDragItemIterator& dragItemIterator);
  774.         // return true if drag is a single item available as a 'PICT'
  775.         
  776.     virtual TCommand* DoMakeDragDropCommand(CommandNumber         itsCommandNumber,
  777.                                             CDragItemIterator&    dragItemIterator);
  778.         // Create and return a command that will be posted by the drag session.
  779.     
  780.     virtual void DoFulfillPromise(TDragItem* promisedItem);
  781.         // Provide promised data on demand.
  782.         
  783. #endif // qDrag
  784.  
  785.     //------------------------------------------------------------------------------------
  786.     // data members
  787.     //------------------------------------------------------------------------------------
  788. public:
  789.     PicHandle fDataHandle;
  790.  
  791.     ResNumber fRsrcID;
  792. };
  793.  
  794. //----------------------------------------------------------------------------------------
  795. // TPictureCommand: Command that manages inserting and removing data from a TPicture.
  796. //----------------------------------------------------------------------------------------
  797.  
  798. class TPictureCommand : public TCommand
  799. {
  800.     MA_DECLARE_CLASS;
  801.  
  802. public:
  803.         TPictureCommand();
  804.             // Constructor
  805.             
  806.         void IPictureCommand(ResNumber newRsrcID, PicHandle newPicHandle,
  807.                 TPicture* itsPictureView, CommandNumber itsCommandNumber, 
  808.                 TCommandHandler* itsContext, Boolean canUndo, Boolean causesChange, 
  809.                 TObject* objectToNotify);
  810.         
  811.         virtual ~TPictureCommand();    
  812.  
  813.         virtual void DoIt();
  814.         
  815.         virtual void UndoIt();
  816.  
  817.     //------------------------------------------------------------------------------------
  818.     // data members
  819.     //------------------------------------------------------------------------------------
  820. protected:
  821.     TPicture*    fPictureView;
  822.     
  823.     PicHandle    fSavedDataHandle;
  824.     
  825.     ResNumber    fSavedRsrcID;
  826. };
  827.  
  828. //----------------------------------------------------------------------------------------
  829. // TStaticText: Provides an object that represents a toolbox static text item.
  830. //----------------------------------------------------------------------------------------
  831.  
  832. class TStaticText : public TControl
  833. {
  834.     MA_DECLARE_CLASS;
  835.     
  836. public:
  837.     TStaticText();
  838.         // Constructor
  839.         
  840.     void IStaticText(TView* itsSuperView,
  841.                                     const VPoint& itsLocation,
  842.                                     const VPoint& itsSize,
  843.                                     SizeDeterminer itsHSizeDet,
  844.                                     SizeDeterminer itsVSizeDet,
  845.                                     ResNumber itsRsrcID,
  846.                                     short itsIndex);
  847.         // Initialize the static text field procedurally.
  848.  
  849.     virtual TObject* Clone();
  850.         // Calls Inherited::Clone and then clones owned objects.
  851.  
  852.     virtual ~TStaticText();
  853.         // Releases the text and then calls Inherited::Free.
  854.  
  855.     //------------------------------------------------------------------------------------
  856.     // Standard signature support.
  857.     //------------------------------------------------------------------------------------
  858.  
  859.     virtual IDType GetStandardSignature();    // Override 
  860.         // Returns this class's standard signature.
  861.  
  862.     //------------------------------------------------------------------------------------
  863.     // Stream I/O protocol support.
  864.     //------------------------------------------------------------------------------------
  865.  
  866.     virtual void ReadFields(TStream* aStream);
  867.     
  868.     virtual void WriteFields(TStream* aStream);
  869.  
  870.  
  871.     virtual void DoSubstitution(CStr255& theText);
  872.         // Calls ReplaceText so that any paramTxt items can be handled if needed.
  873.  
  874.     virtual void Draw(const VRect& area);
  875.         // Draws the text by calling ImageText.
  876.  
  877.     virtual void GetText(CStr255& theText);
  878.         // If fDataHandle not NULL then returns the text, otherwise returns the NULL
  879.         // CString.
  880.  
  881.     virtual void ImageText(Ptr text,
  882.                                   long length,
  883.                                   const VRect& box,
  884.                                   short just);
  885.         // Draws the text.
  886.  
  887.     virtual void ChangeWrap(Boolean newAutoWrap, Boolean redraw);
  888.         // Changes auto-wrapping behavior, redrawing if requested
  889.  
  890.     virtual void ReleaseText();
  891.     // Releases the text by disposing of fDataHandle.
  892.  
  893.     virtual void SetJustification(short theJust, Boolean redraw);
  894.         // Sets the justification of the text to theJust, redrawing if required.
  895.  
  896.     virtual void SetText(const CStr255& theText, Boolean redrawImmediately);
  897.         // Sets the text to theText, redrawing if required.
  898.  
  899.     virtual void SetTextWithStrListID(ResNumber theStrListID, short theIndex, Boolean redraw);
  900.         // Set fDataHandle to the string specified by theStrListID and theIndex and sets fStrListID
  901.         // and fIndex accordingly.
  902.  
  903. #if qDrag
  904.     virtual void DoAddDragContent();
  905.         // Install flavors in the current drag
  906. #endif // qDrag
  907.  
  908.     //------------------------------------------------------------------------------------
  909.     // data members
  910.     //------------------------------------------------------------------------------------
  911. public:
  912.     CStringHandle fDataHandle;                    // A handle to the actual CString.
  913.  
  914.     ResNumber fStrListID;                        // ID of the CString list that the CString
  915.                                                 // is in.
  916.  
  917.     short fIndex;                                // Index number for the CString from the
  918.                                                 // above list.
  919.  
  920.     short fJust;                                // Jusitification of the text in the
  921.                                                 // field.
  922.  
  923.     Boolean fAutoWrap;                            // True to word wrap lines at the view
  924.                                                 // boundary otherwise lines wrap at
  925.                                                 // Carriage return.
  926.  
  927.     Boolean fEraseFirst;                        // control imaging of static text
  928.  
  929. };
  930.  
  931.  
  932. //----------------------------------------------------------------------------------------
  933. // TEditText: Implements an edit text field.
  934. //----------------------------------------------------------------------------------------
  935.  
  936. class TEditText : public TStaticText
  937. {
  938.     MA_DECLARE_CLASS;
  939.     
  940. public:
  941.     TEditText();
  942.         // Constructor
  943.         
  944.     void IEditText(TView* itsSuperView,
  945.                                   const VPoint& itsLocation,
  946.                                   const VPoint& itsSize,
  947.                                   short itsMaxChars);
  948.         // Initialize the edit text item procedurally.
  949.  
  950.     virtual ~TEditText();
  951.         // Un-installs the floating TEView, sets fTEView to NULL then calls Inherited::Free.
  952.  
  953.     //------------------------------------------------------------------------------------
  954.     // Standard signature support.
  955.     //------------------------------------------------------------------------------------
  956.  
  957.     virtual IDType GetStandardSignature();    // Override 
  958.         // Returns this class's standard signature.
  959.  
  960.     //------------------------------------------------------------------------------------
  961.     // Stream I/O protocol support.
  962.     //------------------------------------------------------------------------------------
  963.  
  964.     virtual void ReadFields(TStream* aStream);
  965.     
  966.     virtual void WriteFields(TStream* aStream);
  967.  
  968.     virtual void WriteSubViews(TStream* aStream);
  969.  
  970.  
  971.     virtual void DoSubstitution(CStr255& theText);
  972.         // Default is to do nothing.
  973.  
  974.     virtual void GetText(CStr255& theText);
  975.         // If TEView not NULL then returns the extracted text, otherwise calls Inherited::GetText.
  976.  
  977.     virtual void ImageText(Ptr text,
  978.                                   long length,
  979.                                   const VRect& box,
  980.                                   short just);
  981.         // Sets up the text to the parameters passed. Text is drawn in a 'box' , the text
  982.         // is 'length' long.
  983.  
  984.     virtual Boolean HandleMouseDown(const VPoint& theMouse,
  985.                                            TToolboxEvent* event,
  986.                                            CPoint hysteresis,
  987.                                            EMouseDownType mouseDownType = kDragOrClick);    // Override
  988.     
  989.     virtual void DoMouseCommand(VPoint& theMouse,
  990.                                 TToolboxEvent* event,
  991.                                 CPoint hysteresis);        // Override
  992.                         
  993.     virtual void BecameWindowTarget();                // Override
  994.         // Overridden to install the "floating" TDialogTEView
  995.         
  996.     virtual void BecameTarget();            // Override
  997.         // Overridden to make the "floating" TDialogTEView the target
  998.         
  999.     virtual void SetTargetSelection(Boolean redraw);    // Override
  1000.         // Selects all the characters in this EditText
  1001.     
  1002.     virtual Boolean WantsToBeTarget();    // Override
  1003.  
  1004.     virtual Boolean IsTarget();
  1005.         // Returns true when this object (or its "floating" TEView) is the current target
  1006.  
  1007.     virtual void RestartEdit(const CStr255& restartText);
  1008.         // This method resets the text of the view, as well as selecting the text. We go
  1009.         // to some extra trouble to ensure that this method doesn't do any drawing,
  1010.         // defering to window update time. The reasoning is that this method usually gets
  1011.         // called right after displaying an alert. The alert may have obscured this view,
  1012.         // thus including it in the window's update region. If we drew in this method we
  1013.         // would get flashing as this view would get redraw at update time. Unfortunately
  1014.         // TextEdit isn't very cooperative so we set the clipping to an empty CRect to
  1015.         // ensure that TEActivate's drawing isn't seen.
  1016.  
  1017.     virtual void ChangeWrap(Boolean newAutoWrap, Boolean redraw);
  1018.         // Changes auto-wrapping behavior, redrawing if requested.Forwards into the
  1019.         // floating TE if necessary.
  1020.  
  1021.     virtual void SetJustification(short theJust, Boolean redraw);
  1022.         // Sets the justification of the text to theJust, redrawing is required.
  1023.  
  1024.     virtual void SetSelection(short selStart,
  1025.                                      short selEnd,
  1026.                                      Boolean redraw);
  1027.         // Sets the selection in the field starting at selStart and ending at selEnd,
  1028.         // redrawing if required.
  1029.  
  1030.     virtual void SetText(const CStr255& theText, Boolean redrawImmediately);
  1031.         // Sets the displayed text to theText, redrawing if required.
  1032.  
  1033.     virtual void StartEdit(Boolean selectChars);
  1034.         // Install the selection, revealing the selection if required.
  1035.  
  1036.     virtual void MakeVisible();
  1037.         // Reveal the EditText, if scrolled out of view
  1038.  
  1039.     virtual Boolean Deselect();
  1040.         // Valdates and and deselects the edit text, if possible
  1041.  
  1042.     virtual void StopEdit();
  1043.         // Extracts the CString from the TEView, then clears out the TEView before calling
  1044.         // this->SetText.
  1045.  
  1046.     virtual void InstallFloatingTEView(Boolean selectChars);
  1047.         // Attach the "floating" TDialogTEView to this EditText
  1048.  
  1049.     virtual void RemoveFloatingTEView();
  1050.         // Remove the "floating" TDialogTEView from this EditText.
  1051.  
  1052.     virtual TDialogTEView* GetTEView();
  1053.         // Returns a "floating" TDialogTEView to install in this EditText
  1054.  
  1055.     virtual void ReleaseTEView();
  1056.         // Returns the "floating" TDialogTEView to the server
  1057.  
  1058.     virtual long GetValidationError(); // Override
  1059.         // By default just returns true.
  1060.  
  1061.     virtual void ValidationFailed(long reason);    // Override
  1062.         // Displays an alert when validation fails.
  1063.  
  1064.     virtual void GetDefaultCursorRegion(const VPoint& localPoint,
  1065.                                        RgnHandle cursorRegion); // Override
  1066.         // Sets the cursor region to the control area (i.e. including inset)
  1067.  
  1068. #if qDrag
  1069.  
  1070.     //------------------------------------------------------------------------------------
  1071.     // Drag/Drop Support
  1072.     //------------------------------------------------------------------------------------
  1073.                                 
  1074.     virtual RgnHandle DoMakeDragCursorRegion(); // Override
  1075.         // Provide a drag test region in local coordinates.
  1076.  
  1077.     virtual Boolean WillDrag(const VPoint& theMouse, const RgnHandle dragCursorRegion); // Override
  1078.         // Return true if a mouse click at theMouse would begin a drag
  1079.  
  1080.     virtual short GetWillDragCursorID();    // Override
  1081.         // display quickdraw arrow cursor
  1082.         
  1083.     virtual short GetIsDraggingCursorID();    // Override
  1084.         // display quickdraw arrow cursor
  1085.  
  1086.     virtual void DoAddDragContent(); // Override
  1087.         // Add text content
  1088.  
  1089.     virtual Boolean WillAcceptDrop(CDragItemIterator& dragItemIterator); // Override
  1090.         // Return true if the drag contains a single text item
  1091.     
  1092.     virtual void DoDragEnter(); // Override
  1093.         // Become the current drop target. Install a floating text edit view
  1094.         
  1095.     virtual RgnHandle DoMakeDropHiliteRegion(); // Override
  1096.         // Create a local region that will represent the drop area
  1097.  
  1098.     virtual void DoDragWithin(const VPoint& localMouse); // Override
  1099.         // Tell the fTEView to manage mouse tracking during a drag.
  1100.  
  1101.     virtual void DoDragLeave(); // Override
  1102.         // Notify the TEView that the drag has left
  1103.     
  1104.     virtual TCommand* DoMakeDragDropCommand(CommandNumber         itsCommandNumber,
  1105.                                             CDragItemIterator&     dragItemIterator);    // Override
  1106.         // Create a drag drop command.
  1107.         
  1108.     virtual void DoFulfillPromise(TDragItem* promisedItem); // Override
  1109.         // Provide promised flavor on demand
  1110.         
  1111. #endif // qDrag
  1112.  
  1113.     //------------------------------------------------------------------------------------
  1114.     // data members
  1115.     //------------------------------------------------------------------------------------
  1116. public:
  1117.     TDialogTEView* fTEView;
  1118.  
  1119.     ControlCharSet fControlChars;                // Control chars accepted in text
  1120.  
  1121.     short fMaxChars;
  1122. }; // class TEditText
  1123.  
  1124.  
  1125. //----------------------------------------------------------------------------------------
  1126. // TNumberText: This subclass of TEditText that allows the handling of integer numbers.
  1127. // Range checking will be performed on the numbers entered to see if they are in the range
  1128. // fMinimum to fMaximum.
  1129. //----------------------------------------------------------------------------------------
  1130.  
  1131. class TNumberText : public TEditText
  1132. {
  1133.     MA_DECLARE_CLASS;
  1134.     
  1135. public:
  1136.     TNumberText();
  1137.         // Constructor
  1138.     virtual ~TNumberText();
  1139.         // Destructor
  1140.         
  1141.     void INumberText(TView* itsSuperView,
  1142.                                     const VPoint& itsLocation,
  1143.                                     const VPoint& itsSize,
  1144.                                     long itsValue,
  1145.                                     long itsMinimum,
  1146.                                     long itsMaximum);
  1147.         // Initialize the number text item procedurally.
  1148.  
  1149.     //------------------------------------------------------------------------------------
  1150.     // Standard signature support.
  1151.     //------------------------------------------------------------------------------------
  1152.  
  1153.     virtual IDType GetStandardSignature();    // Override 
  1154.         // Returns this class's standard signature.
  1155.  
  1156.     //------------------------------------------------------------------------------------
  1157.     // Stream I/O protocol support.
  1158.     //------------------------------------------------------------------------------------
  1159.  
  1160.     virtual void ReadFields(TStream* aStream);
  1161.     
  1162.     virtual void WriteFields(TStream* aStream);
  1163.  
  1164.  
  1165.     virtual long GetValue();
  1166.         // Returns the current value by getting the CString and converting it to a number.
  1167.  
  1168.     virtual void SetValue(long newValue, Boolean redraw);
  1169.         // Sets the current value by converting the number to a CString and then calling SetText.
  1170.  
  1171.     virtual long GetValidationError();
  1172.         // Does a range check on the number and if it is out of range returns the
  1173.         // appropriate error code.
  1174.  
  1175.     //------------------------------------------------------------------------------------
  1176.     // data members
  1177.     //------------------------------------------------------------------------------------
  1178. public:
  1179.     long fMinimum;
  1180.  
  1181.     long fMaximum;
  1182. };
  1183.  
  1184.  
  1185. //----------------------------------------------------------------------------------------
  1186. // TDialogTEView: Provides a floating TEView that is placed over edit & number text fields
  1187. // when entering text.
  1188. //----------------------------------------------------------------------------------------
  1189.  
  1190. class TDialogTEView : public TTEView
  1191. {
  1192.     MA_DECLARE_CLASS;
  1193.     
  1194. public:
  1195.  
  1196.     TDialogTEView();
  1197.         // Constructor
  1198.         
  1199.     void IDialogTEView(TDocument* itsDocument,
  1200.                                       TView* itsSuperView,            
  1201.                                       const VPoint& itsLocation,
  1202.                                       const VPoint& itsSize,
  1203.                                       SizeDeterminer itsHDeterminer,
  1204.                                       SizeDeterminer itsVDeterminer,
  1205.                                       const VRect& itsInset,
  1206.                                       const TextStyle& itsTextStyle,
  1207.                                       short itsJustification,
  1208.                                       Boolean itsStyleType,
  1209.                                       Boolean itsAutoWrap);
  1210.         // For Initialization of procedurally created TEView.
  1211.  
  1212.     virtual TObject* Clone();
  1213.         // calls Inherited::Clone and then clones owned objects.
  1214.  
  1215.     virtual ~TDialogTEView();
  1216.         // Free associated components and then free this.
  1217.  
  1218.     //------------------------------------------------------------------------------------
  1219.     // Stream I/O protocol support.
  1220.     //------------------------------------------------------------------------------------
  1221.  
  1222.     virtual void ReadFields(TStream* aStream);
  1223.     
  1224.     virtual void WriteFields(TStream* aStream);
  1225.  
  1226.     //------------------------------------------------------------------------------------
  1227.     //  Commands and Menus
  1228.     //------------------------------------------------------------------------------------
  1229.  
  1230.     virtual void InstallEditText(TEditText* theEditText, Boolean selectChars);
  1231.         // Installs the EditText adding this as a subview to EditText, then gets the text
  1232.         // from the EditText item and installs it in this.
  1233.  
  1234.     virtual void ComputeFrame(VRect& newFrame);
  1235.         // accounts for case in which horizontal determiner is sizeVariable should be
  1236.         // added to TTEView !!!
  1237.  
  1238.     virtual void ResignedTarget();    // Override
  1239.  
  1240.     virtual long WillingToResignTarget();    // Override
  1241.         // !!!
  1242.  
  1243.     virtual void TargetValidationFailed(long reason);    // Override
  1244.  
  1245.     virtual TEditText* GetEditText(); // override
  1246.         // Get the edit text view, if any, that owns this TE view. 
  1247.  
  1248. #if qDrag
  1249.     
  1250.     //------------------------------------------------------------------------------------
  1251.     // Drag and Drop support
  1252.     //------------------------------------------------------------------------------------
  1253.     
  1254.     Boolean WillDrag(const VPoint& localMouse, const RgnHandle dragCursorRegion); // override
  1255.  
  1256.     virtual TView* DoGetDragProxy();
  1257.     
  1258.     inline short GetLastDropCaretOffset() {return fLastCaretOffset;}
  1259.     
  1260. #endif // qDrag
  1261.  
  1262.     //------------------------------------------------------------------------------------
  1263.     // data members
  1264.     //------------------------------------------------------------------------------------
  1265. public:
  1266.     TEditText* fEditText;                        // The edit text field to which the
  1267.                                                 // floating TEView is currently tied.
  1268.  
  1269.     TScroller* fScroller;                        // The scroller that I am in for
  1270.                                                 // mouseability.
  1271. };
  1272.  
  1273.  
  1274. //----------------------------------------------------------------------------------------
  1275. // TTargetBorderView
  1276. //----------------------------------------------------------------------------------------
  1277.  
  1278. class TTargetBorderView : public TView
  1279. {
  1280.     MA_DECLARE_CLASS;
  1281.     
  1282. public:
  1283.     TTargetBorderView();
  1284.         // Constructor
  1285.     virtual ~TTargetBorderView();
  1286.         // Destructor
  1287.         
  1288.     void ITargetBorderView(TDocument* itsDocument,
  1289.                               TView* itsSuperView,
  1290.                               const VPoint& itsLocation,
  1291.                               const VPoint& itsSize,
  1292.                               SizeDeterminer itsHSizeDet,
  1293.                               SizeDeterminer itsVSizeDet,
  1294.                               IDType itsTargetView);
  1295.         // Initialization method for TTargetBorderView
  1296.  
  1297.     virtual IDType GetStandardSignature();    // Override 
  1298.         // Returns this class's standard signature.
  1299.         
  1300.     virtual void ReadFields(TStream* aStream);
  1301.     virtual void WriteFields(TStream* aStream);
  1302.     virtual void DoEvent(EventNumber eventNumber,
  1303.                                 TEventHandler* source,
  1304.                                 TEvent* event);    // Override
  1305.     virtual void DoMouseCommand(VPoint& theMouse, 
  1306.                                 TToolboxEvent* event,
  1307.                                 CPoint hysteresis); // Override
  1308.     virtual void ComputeBorderRegion(RgnHandle borderRegion);
  1309.     virtual void InvalidateBorderRegion();
  1310.     virtual void Draw(const VRect& area); // Override
  1311.     virtual void SetFrame(const VRect& newFrame, Boolean invalidate); // Override
  1312.     
  1313.     virtual Boolean ContainsTarget(TEventHandler *target);
  1314.         // return true if the relationship between this view and the target
  1315.         // determines that the border should be drawn
  1316.  
  1317.     //------------------------------------------------------------------------------------
  1318.     // data members
  1319.     //------------------------------------------------------------------------------------
  1320. public:
  1321.     IDType    fTargetView;
  1322.  
  1323. };
  1324.  
  1325. //----------------------------------------------------------------------------------------
  1326. // TFloatingTEManager: Acts as a "server" for the "floating" TDialogTEViews installed in
  1327. // EditTexts. A one-view cache is maintained
  1328. //----------------------------------------------------------------------------------------
  1329.  
  1330. class TFloatingTEManager : public TObject
  1331. {
  1332.     MA_DECLARE_CLASS;
  1333.     
  1334. public:
  1335.     TFloatingTEManager();
  1336.         // Constructor
  1337.         
  1338.     void IFloatingTEManager();
  1339.         // Initialization method for TFloatingTEManager .
  1340.         
  1341.     virtual ~TFloatingTEManager();
  1342.         // Frees the cache, and calls Inherited::Free.
  1343.  
  1344.     virtual TDialogTEView* AcquireFloatingTE();
  1345.         // Returns a "floating" TDialogTEView to install in an EditText. If the cache is
  1346.         // empty, one is created.
  1347.  
  1348.     virtual TDialogTEView* MakeDialogTEView();
  1349.  
  1350.     virtual void ReleaseFloatingTE(TDialogTEView* aDialogTEView);
  1351.         // Places the specified TDialogTEView in the cache, or frees it if the cache is
  1352.         // full.
  1353.  
  1354.     //------------------------------------------------------------------------------------
  1355.     // data members
  1356.     //------------------------------------------------------------------------------------
  1357. public:
  1358.     TDialogTEView* fCache;
  1359. };
  1360.  
  1361.  
  1362. //----------------------------------------------------------------------------------------
  1363. // Externally available function declaration.
  1364. //----------------------------------------------------------------------------------------
  1365.  
  1366. extern void InitUDialog();
  1367.     // This routine must be called if UDialog is used so that all the necessary
  1368.     // initialization can be performed. Sets the global flag 'gUDialogInitialized' after
  1369.     // the initalization is performed.
  1370.  
  1371. extern TDialogTEView* AcquireFloatingTEView();
  1372.     // Called by EditTexts to obtain a "floating" TDialogTEView to install. Procedural
  1373.     // interface to TFloatingTEManager::AcquireFloatingTE.
  1374.  
  1375. extern void ReleaseFloatingTEView(TDialogTEView* aDialogTEView);
  1376.     // Called by EditTexts when deselecting. Procedural interface to
  1377.     // TFloatingTEManager::ReleaseFloatingTE.
  1378.  
  1379. //    extern void MAParamText(const CStr255& keyStr, const CStr255& valueStr);
  1380. //        // Used to create paramTxt items for a dialog. Builds an association with keyStr and
  1381. //        // valueStr. All instances of keyStr in the dialog will be replaced with valueStr when
  1382. //        // the dialog is displayed.
  1383.  
  1384. //    extern void MAReplaceText(CStr255& theText);
  1385. //        // If there are any param text items in the theText passed to this method then they
  1386. //        // are replaced with the appropriate values.
  1387.  
  1388.  
  1389. //----------------------------------------------------------------------------------------
  1390. // Externally available variable declarations.
  1391. //----------------------------------------------------------------------------------------
  1392.  
  1393. extern TFloatingTEManager* gFloatingTEManager;
  1394.  
  1395. #endif // __UDIALOG__
  1396.